package com.example.swagger.service;

import com.example.swagger.entity.Department;
import com.example.swagger.entity.Employee;
import com.example.swagger.mapper.DepartmentMapper;
import com.example.swagger.mapper.EmployeeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
@Component
public class EmployeeService {
    @Autowired
    private EmployeeMapper employeeMapper;
    public List<Employee> getEmployees(){
        return employeeMapper.getEmployees();
    }

    public void addEmployee(Integer id, String lastName, String email, Integer gender, Department department, Date birthday){
        employeeMapper.insertEmployee(id, lastName,email,gender,department,birthday);
    }

    public Employee getEmployeeById(Integer id){
        return employeeMapper.getEmployeeById(id);
    }

    public void deleteDepartment(Integer id){
        employeeMapper.deleteEmployeeById(id);
    }
}
